﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PMS.Data.DbUtils.DataMapping;
using PMS.Data.Entities.NaviMenus;

namespace PMS.Data.EntityMap.NaviMenus
{
    /// <summary>
    /// Represents a NaviMenuLayoutTemplate mapping configuration
    /// </summary>
    public partial class NaviMenuLayoutTemplateMap : PMSEntityTypeConfiguration<NaviMenuLayoutTemplate>
    {
        #region Methods

        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityTypeBuilder<NaviMenuLayoutTemplate> builder)
        {
            builder.ToTable("bus_navimenutemplate");
            builder.HasKey(tpl => tpl.Id);

            builder.Property(tpl => tpl.TemplateName).HasMaxLength(128).IsRequired();
            builder.Property(tpl => tpl.TemplateDescription).HasMaxLength(200).IsRequired();
            builder.Property(tpl => tpl.TemplateType).IsRequired();
            builder.Property(tpl => tpl.ViewPath).HasMaxLength(200);
            builder.Property(tpl => tpl.PageSize).IsRequired();
            builder.Property(tpl => tpl.PageSizeOptions).HasMaxLength(128).IsRequired();
            builder.Property(tpl => tpl.TemplatePreviewImageId).IsRequired();
            builder.Property(tpl => tpl.DisplayOrder).IsRequired();
            builder.Property(tpl => tpl.IsActive).IsRequired();
            builder.Property(tpl => tpl.CreatedOnTimeUtc).IsRequired();
            builder.Property(tpl => tpl.UpdatedOnTimeUtc).IsRequired();

            builder.Ignore(tpl => tpl.PageSizeOptionList);

            base.Configure(builder);
        }

        #endregion
    }
}
